package com.grace.controller;

import com.grace.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    private EmpService empService;


    @RequestMapping("/getMap")
    @ResponseBody
    public Map<String,Object> getMap() {
        //获得部门名
        List<String> deptName = empService.getDeptName();
        //获得部门人数
        List<Integer> deptNum = empService.getDeptNum();
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("deptName", deptName);
        map.put("deptNum", deptNum);
        return map;
    }


}
